import { Equal, Expect } from "@type-challenges/utils";

type RemoveIndexSignature<T> = {
  [P in keyof T as string extends P
    ? never
    : number extends P
    ? never
    : P]: T[P];
};

// type RemoveIndexSignature<T> = {
//   [P in keyof T as P extends `${infer R}` ? R : never]: T[P];
// };

type Foo = {
  [key: string]: any;
  "foo"(): void;
};

type Bar = {
  [key: number]: 1;
  bar(): void;
};

type Baz = {
  bar(): void;
  baz: string;
};

type cases = [
  Expect<Equal<RemoveIndexSignature<Foo>, { foo(): void }>>,
  Expect<Equal<RemoveIndexSignature<Bar>, { bar(): void }>>,
  Expect<Equal<RemoveIndexSignature<Baz>, { bar(): void; baz: string }>>
];
